
if exists (select 1 from sysobjects where name = 'get_saldoanpassung' and type = 'P')
begin
   drop procedure get_saldoanpassung
   print 'Procedure: get_saldoanpassung deleted ...'
end
go
create procedure get_saldoanpassung(
  @prsid              int           = 1,
  @abteilungid        int           = 1,
  @planid             int           = 4
)
as
begin
  set nocount on

  select saldoid = SaldoID,
         datum = Datum,
         grund = Grund,
         stunden = Stunden,
         planid = PlanID,
         abteilungid = AbteilungID,
         prsid = PrsID
    from Saldoanpassung 
   where PrsID = @prsid
     and AbteilungID = @abteilungid
     and PlanID = @planid

end
go
print 'Procedure: get_saldoanpassung done ...'
go
grant exec on get_saldoanpassung to prsadmins with grant option
go
grant exec on get_saldoanpassung to prsusers
go

